# Tokens

Tokens are used for authenticating an Adafruit IO user. See the _Authentication_ page for more information about this.

## Get All Tokens

> HTTP Request
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/tokens</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/tokens
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
[
  {
    "token": "string"
  }
]
```

An array of tokens




### Path Parameters


Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string



## Create Token

> HTTP Request
> <div class="http"><span class="method-post">POST</span><code class="path">/api/v2/{username}/tokens</code></div>

```shell
$ curl -F 'token=uniqueToken' -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/tokens
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
{
  "token": "string"
}
```

New Token



### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string


### Body Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
token | object | true |



## Returns Token

> HTTP Request
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/tokens/{id}</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/tokens/{id}
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
{
  "token": "string"
}
```

Token response




### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
id | string | true |



## Delete Token

> HTTP Request
> <div class="http"><span class="method-delete">DELETE</span><code class="path">/api/v2/{username}/tokens/{id}</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/tokens/{id}
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
"string"
```

Deleted Token successfully


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
id | string | true |










